package com.itramp.shaker;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

/**
 * welcome activity with full screen and no title.
 * 
 * @author qingshan_liu
 * @since 2011-9-20
 */
public class About extends Activity {
	private TextView tv;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		//set full screen
		enableFullScreen(this.getWindow());
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.welcome);
		
		tv=(TextView)findViewById(R.id.tv_welcome);
		String sIntro=getString(R.string.app_intro);
		sIntro+=getString(R.string.app_current_version);
		sIntro+=getString(R.string.app_latest_version);
		sIntro+=getString(R.string.app_promise_title);
		sIntro+=getString(R.string.app_promise_item1);
		sIntro+=getString(R.string.app_promise_item2);
		tv.setText(sIntro);
		
		new Handler().postDelayed(new Runnable() {
			
			@Override
			public void run() {
				Intent redirectIntt=new Intent(About.this,IndexActivity.class);
				About.this.startActivity(redirectIntt);
				About.this.finish();
				
				overridePendingTransition(R.anim.zoomin, R.anim.zoomout);
			}
		},2000);
	}
	
	private void enableFullScreen(Window win){
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		int windowFlag=WindowManager.LayoutParams.FLAG_FULLSCREEN;
		win.setFlags(windowFlag, windowFlag);
	}
}
